<template>
  <div class="app-container">
    <div class="filter-container">
      <el-input v-model="listQuery.username" placeholder="用户账号" class="filter-item" clearable/>
      <div class="filter-item">
        <div class="searchItem">
          <span class="searchLabel">筛选日期：</span>
          <DatePicker :mode="1" :startDate.sync="listQuery.beginTime" :endDate.sync="listQuery.endTime" clearable />
        </div>
      </div>
      <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getList">
        查询
      </el-button>
    </div>
    <el-card class="box-card" shadow="hover">
      <div slot="header" class="clearfix">
        <span>用户统计</span>
      </div>
      <el-table ref="table" v-loading="listLoading" :data="list" fit highlight-current-row row-key="id" style="width: 100%;">
        <el-table-column label="订单总数量" prop="num" align="center" />
        <el-table-column label="订单总金额" prop="amount" align="center" />
        <el-table-column label="客单价" prop="customerAmount" align="center" />
        <el-table-column label="登录次数" prop="login" align="center" />
        <el-table-column label="商品点击次数" prop="productBrowse" align="center" />
      </el-table>
    </el-card>
  </div>
</template>

<script>

import { queryMemberDataAnalysis } from '@/api/zcyx'
import DatePicker from '@/components/DatePicker'
import waves from '@/directive/waves'

export default {
  name: "UserAnalysis",
  directives: { waves },
  props: {

  },
  components: {
    DatePicker
  },
  data() {
    return {
      list: [],
      listLoading: true,
      listQuery: {
        username: '',//15116655410
        beginTime: '',
        endTime: '',
      },
    }
  },
  computed: {

  },
  watch: {},
  methods: {
    getList() {
      this.listLoading = true
      queryMemberDataAnalysis(this.listQuery).then(response => {
        this.list = [(response || {})]
        this.listLoading = false
      }).catch(error => {
        console.log(error);
        this.listLoading = false
      })
    },
  },
  created() {
    this.getList()
  },
  mounted() {
    
  },
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
  updated() {}, // 生命周期 - 更新之后
  beforeDestroy() {}, // 生命周期 - 销毁之前
  destroyed() {}, // 生命周期 - 销毁完成
  activated() {}, // 如果页面有keep-alive缓存功能，这个函数会触发
}
</script>

<style lang='scss' scoped>
  .searchItem {
    display: flex;
    align-items: center;
    .searchLabel {
      color: #666;
    }
  }
</style>